package demo;

import lombok.NoArgsConstructor;

//格式换ctrl+alt+L
@NoArgsConstructor
public class GoldCard extends Card {

    public GoldCard(String cardId, String name,String phone, double money) {
        super(cardId, name, phone,money);
    }

    @Override
    public void consume(double money) {
        System.out.println("当前消费金额" + money);
        System.out.println("当前消费打折后金额" + 0.8 * money);
        if(getMoney()< 0.8*money){
            System.out.println("您当前余额为"+getMoney()+"余额不足,请存钱");
            return;
        }
        //更新账户金额
        setMoney(getMoney() - 0.8 * money);
        if (0.8 * money > 200) {
            this.printTicket();
        } else {
            System.out.println("消费金额太少，无法获得洗车票");
        }
    }

    public void printTicket() {
        //判断消费如果大于200，打印洗车票
        System.out.println("恭喜你获得一张洗车票");
    }
}
